var URL = require('url');
var express = require('express');
var router = express.Router();
var User = require('./user');

/* GET users listing. */
router.get('/', function (req, res, next) {
  res.send('respond with a resource');
});

router.get('/getUserInfo', (req, res, next) => {
  let user = new User();
  let params = URL.parse(req.url, true).query;
  if (params.id == '1') {
    user.name = "light"
    user.age = "21"
    user.city = "南州市"
  } else {
    user.name = "SPTING";
    user.age = "1";
    user.city = "杭州市";
  }

  var response = {status:1,data:user};
  res.send(JSON.stringify(response));
})

module.exports = router;
